<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<title></title>
		<script src="js/jquery-1.11.0.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<center>
			<form action="???">
				<input type="text" name="username" id="username" value="" />
				<input type="password" name="password" id="password" />
				<input type="password" name="pwd" id="pwd" />
				<input type="button" class="submit" value="注册" /> <a href="login.html">登录</a>
			</form>
		</center>
	</body>
	<script type="text/javascript">
		$(document).ready(function(){
			$(".submit").click(function(){
				$.ajax({
					type:"get",
					url:"http://localhost/future/reg/",
					async:true,
					dataType:"jsonp",
					jsonpCallback:"t",
					data:{
						username:$("#username").val(),
						password:$("#password").val(),
						pwd:$("#pwd").val()
					},
					success:function(response,status,xhr){
						if (status=="success") {
							if (response.code==4000) {
								alert(response.msg);
								window.location.href = "login.html";
							}else if (response.code ==4001) {
								alert(response.msg);
							}else if (response.code = 4002) {
								alert(response.msg);
							} else{
								alert(response.msg);
							}
						}
					}
				});
			});
		});
	</script>
</html>
